package win.itshen.cloud.adminlte.common.shiro;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import win.itshen.cloud.adminlte.modules.admin.entity.SysUser;

/**
 * Shrio相关工具类
 */
public class ShiroUtils {
    public static Subject getSubject() {
        return SecurityUtils.getSubject();
    }

    public static SysUser getUser() {
        return (SysUser) getSubject().getPrincipal();
    }

    public static Long getUserId() {
        return getUser().getId();
    }

    public static void logout() {
        getSubject().logout();
    }

}
